﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;
public partial class IndexHouseDetail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            int HouseId = Convert.ToInt32(Request["HouseId"]);
            House house = HouseManage.GetHouseById(HouseId);
            this.lbl_AdrrContext.Text = house.Address;
            this.lbl_IntakeTimeContext.Text = Convert.ToString(house.IntakeTime);
            this.lbl_OverViewContext.Text = house.Standard;
            this.lbl_PriceContext.Text = Convert.ToString(house.Price);
            this.img_Lager.ImageUrl = house.LargeImageUri;
            this.lbl_AdminReview.Text += house.AdminReview;
            PersonalInformation person = HouseManage.getHouseHolderInfByHouseID(HouseId);
            this.lbl_PhoneContext.Text = person.Phone;
            int ClientId = Convert.ToInt32(Session["UserId"]);//自定义，应修改为Session["userID"]

            bool isHas = ClientManage.HasId(ClientId);
            if (!isHas)
            {
                this.btn_Order.Visible = false;
                this.btn_Collect.Visible = false;
            }
        }
    }
    protected void btn_Collect_Click(object sender, EventArgs e)
    {
        int HouseId = Convert.ToInt32(Request["HouseId"]);
        int ClientId = Convert.ToInt32(Session["UserId"]);//自定义，应修改为Session["userID"]
        Model.HouseMark housemark = new Model.HouseMark();
        housemark.HouseId = HouseId;
        housemark.ClientId = ClientId;
        HouseMarkManage.Insert(housemark);
        Response.Redirect("HouseMark.aspx");
    }
}